import axios from 'axios'

import {
    Message
} from 'element-ui';

const request = axios.create({
    timeout: 3000
});

request.interceptors.request.use(
    config => {
        return config;
    },
    err => {
        Message.error('请求异常！！！')
    }
)

request.interceptors.response.use(
    response => {
        let res = {};
        res.status = response.status;
        res.data = response.data;
        return res;
    },
    err => {
        Message.error('响应异常！！！')
    }
)

export default request